package uc.org.jkas.app.admin;
import java.util.HashMap;
import java.util.ArrayList;
import uc.org.jkas.model.MemberlogsM;
import org.jkas.utils.Page;
public class Memberlogs extends BackBase
{ MemberlogsM mlm=new MemberlogsM();
	public void index()
    {  if(IS_POST())
		{
		}
		else
		{int page=Pint("page");
		 int pagenum=20;
		 Page p=new Page(page,pagenum);
		 ArrayList<HashMap> lists=mlm.fields("m.*,ml.log_id,ml.login_time,ml.login_ip,a.name as appname").table("memberlogs ml").join("members m","ml.uid","m.uid").join("applications a","ml.appid","a.appid").limit(p.getPos(),pagenum).count().order("log_id desc").select();
		 p.setCount(mlm.getCount());
		 assign("pageinfo",p.getInfo());
		 assign("lists",lists);
		 display();
		}
	}

	public void drop()
	{  String res=JSON_RESULT_FAILED;
	  if(IS_POST())
		{
		 int id=Pint("id");
		 String ids=P("ids");
	     if((id>0 && mlm.dropInfo(id)>0) || !isEmpty(ids) && mlm.where(strc("log_id in(",ids,")")).delete()>0)
		 {res=JSON_RESULT_SUCCESS;
		 }
		}
		echo(res);
	}

	public void clear()
	{  String res=JSON_RESULT_FAILED;
	  if(IS_POST())
		{
	     if(this.mlm.clear()>=0)
		 {res=JSON_RESULT_SUCCESS;
		 }
		}
		echo(res);
	}

}